function People(name,age){
  this.name=name;
  this.age=age;
  this.say = function () {
      let _this=this;
      setTimeout(function () {
        // 因为function有他自己的作用域,所以this指向undefined,
        // 解决办法：let _this=this;
          console.log(_this.name);
      },1000);
  }
}
var p1 = new People("zhangsan", 15);
p1.say();  // undefined //zhangsan


function People2(name,age){
  this.name=name;
  this.age=age;
  this.say = function(){
      setTimeout(()=>{
          console.log(this.name);
      },1000);
  }
}
var p2 = new People2("lisi", 15);
p2.say();  //lisi